package com.ewanghuiju.app.presenter.resale;

import com.ewanghuiju.app.app.Constants;
import com.ewanghuiju.app.base.RxPresenter;
import com.ewanghuiju.app.base.contract.resale.ResalePublishShopContract;
import com.ewanghuiju.app.base.contract.resale.ResaleSureOrderContract;
import com.ewanghuiju.app.component.RxBus;
import com.ewanghuiju.app.model.DataManager;
import com.ewanghuiju.app.model.bean.response.AddressListResponBean;
import com.ewanghuiju.app.model.bean.response.UserInfoResponBean;
import com.ewanghuiju.app.model.event.SendEvent;
import com.ewanghuiju.app.model.http.exception.ApiException;
import com.ewanghuiju.app.model.http.response.BaseResponse;
import com.ewanghuiju.app.model.http.response.Optional;
import com.ewanghuiju.app.util.RxUtil;
import com.ewanghuiju.app.widget.CommonSubscriber;

import javax.inject.Inject;

import io.reactivex.annotations.NonNull;
import io.reactivex.functions.Predicate;

/**
 * @author sj  qq:751943509
 * @class 转售发布订单
 * @time 2020/2/16
 */
public class ResalePublishShopPresenter extends RxPresenter<ResalePublishShopContract.View> implements ResalePublishShopContract.Presenter {

    private DataManager mDataManager;
    private int currentType = Constants.TYPE_ADDRESS_SELECTED;

    @Inject
    public ResalePublishShopPresenter(DataManager mDataManager) {
        this.mDataManager = mDataManager;
    }

    @Override
    public void getData() {

    }

    /**
     * 转售购买订单
     *
     * @param goods_id
     * @param goods_num
     * @param address_id
     * @param pay_password
     */
    @Override
    public void nowPay(String goods_id, String goods_num, String address_id, String pay_password, String orderRemarks) {
//        addSubscribe(mDataManager.integralConversion(goods_id, goods_num,
//                address_id, pay_password, orderRemarks)
//                .compose(RxUtil.rxSchedulerHelper())
//                .compose(RxUtil.handleMyResultCannull())
//                .subscribeWith(new CommonSubscriber<Optional<BaseResponse>>(mView) {
//                    @Override
//                    public void onNext(Optional<BaseResponse> optional) {
//                        if (mView != null)
//                            mView.showPay(optional.getIncludeNull());
//                    }
//
//                    @Override
//                    public void onError(Throwable e) {
//                        super.onError(e);
//                        if (mView != null) {
//                            if (e instanceof ApiException) {
//                                mView.showPayError(((ApiException) e).getCode(), e.getMessage());
//                            }
//                        }
//                    }
//
//                    @Override
//                    public void onComplete() {
//                        super.onComplete();
//                    }
//                })
//        );
    }
}
